#pragma once
#include <sys/time.h>
#include <list>
#include <string>
#include <boost/function.hpp>

namespace sevent{

class Server;
class Connect;
class Task {
public:
	typedef boost::function <int (Connect *)> TaskFunc;
	Task(Server *s, Connect *c);
	Task(Server *s, Connect *c, const TaskFunc &f);
	~Task();
	
	int execute();
//	int reset();
	struct timeval &createTime() {
		return _createTime;
	}

	Connect *connect(){return _connect;}
private:
	Server *_parentServer;
	Connect *_connect;
	TaskFunc _runFunc;

	struct timeval _createTime;

	Task(const Task & other);
	Task & operator =(const Task & other);
};


}

